/**
 * 打印日志
 */
var _list = [];

/**
 * 定义打印日志的内容
 */
function trace(value, msg) {
  var _pages = getCurrentPages();
  var _baseInfo = "";
  //打印页面路径
  if (_pages && _pages.length > 0) {
    _baseInfo = "----" + _pages[_pages.length - 1].route + ": "
  } else {
    _baseInfo = "----app: ";
  }
  //打印消息
  if (msg) {
    console.log(_baseInfo + msg + "  ", value);
  } else {
    console.log(_baseInfo, value);
  }
  
  // console.log(value);
  // list.push(getCurrentPages()[getCurrentPages().length - 1].route + " : " + value);
}

/**
 * 获取日志列表
 */
function getList() {
  return list;
}

module.exports = {
  trace: trace,
  getList: getList
}